#include "CProduction_If.h"

#include "../NativeGrammar.h"


CTokenPtr CProduction_If::Reduce( CProductionArgPtr pArgs )
{
	CStatementIfPtr pIfStatement = CStatementIf::create(pArgs->getArg<CExpression>(3), pArgs->getArg<CStatementList>(5));

	pIfStatement->eval();

	return pIfStatement;
}

CTokenPtr CProduction_If_Else::Reduce( CProductionArgPtr pArgs )
{

	CStatementIfPtr pIfStatement = CStatementIf::create(pArgs->getArg<CExpression>(3),
		pArgs->getArg<CStatementList>(5),pArgs->getArg<CStatementList>(9));

	pIfStatement->eval();

	return pIfStatement;
}